package com.qf.controller;

import com.qf.pojo.ResponseData;
import com.qf.pojo.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * 用户的控制器
 */
@Controller
@RequestMapping("/user")
public class UserController {
    private static Map map = new HashMap();
    @Autowired
    private UserService userService;

    /**
     * 登录
     * @param user
     * @return
     */
    @RequestMapping("/login")
    @ResponseBody
    public ResponseData login(User user){
        User users =userService.login(user.getUsername(),user.getPassword());
        if (users!=null){

        return new ResponseData(1,"恭喜,登录成功");}
        return null;
    }



}
